home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 4 / The 640 Meg Shareware Studio CD-ROM Volume IV (Data Express)(1994).ISO / 4dos / arconv01.zip / TO1.DAT < prev    next >
Text File  |  1993-06-30  |  2KB  |  85 lines

  1. @echo off
  2. loadbtm on
  3. setlocal
  4.  
  5. :: to.btm, 27 Jun 1993, by E.T.C, Ver 1.00
  6. :: Run with no arguments for a syntax description
  7. :: This batch file converts archive files from one format to another.
  8. :: It calls a.btm & da.btm to create & extract archives, So if you wish
  9. :: to add archive formats, you must modify a.btm & da.btm.
  10. :: to.btm maintains a file of statistics.
  11. :: If you wish to keep the logging, change line to the correct path.
  12. :: The archive formats recognized are the ones in a.btm and da.btm
  13. :: At the current version, no extra parameters can be passed to archiver.
  14. :: Options:
  15. :: -max will delete the smaller file (either original or -converted file).
  16. :: -y will delete without prompting the archive to be deleted (either the
  17. :: original file, or the larger one, with -max).
  18. :: -n will NOT delete, and will not prompt for deletion.
  19. :: The above two are good for batch mode. Default prompts before deletion.
  20. :: anyways appear when comverting to a filename that already exists.
  21. :: Quits with 0 for success, 1 for error, so preferably, have a.btm & da.btm
  22. :: return the same, for easy detection.
  23.  
  24. set DEFAULT=arj
  25.  
  26. :: Syntax checking:
  27.  
  28. if "%1" == "" goto syntax
  29. iff "%1" == "-max" then
  30.   set MAX=TRUE
  31.   shift
  32. else
  33.   set MAX=FALSE
  34. endiff
  35. if "%1" == "" goto syntax
  36. :: Default deletion: prompt before.
  37. set DELETE=del /p
  38. iff "%1" == "-y" then
  39.   set DELETE=del /q
  40.   shift
  41. else
  42.   iff "%1" == "-n" then
  43.     set DELETE=rem
  44.     shift
  45.   endiff
  46. endiff
  47. if "%1" == "" goto syntax
  48. iff "%2" == "" .or. exist %1 .or. isdir %1 then
  49.   set ARC=%DEFAULT
  50. else
  51.   set ARC=%1
  52.   shift
  53. endiff
  54.  
  55. if isdir $$$$TEMP.$$2 .or. exist $$$$TEMP.$$2 goto error
  56. md $$$$TEMP.$$2
  57. :: Storage for already-converted archives
  58.  
  59. for /a-d %RUN in ( %& ) do (
  60.   iff "%RUN" != "$$$$TEMP.$$2" then
  61.     iff "%RUN" != "DESCRIPT.ION" then
  62.       echo Working on %RUN
  63.       gosub main_loop
  64.     endiff
  65.   endiff
  66. )
  67. goto end
  68.  
  69. :main_loop
  70.  
  71. set FILENAME=%@NAME[%RUN]
  72. if "%@EXT[%RUN]" == "" goto syntax
  73. iff %@LOWER[%@EXT[%RUN]] == %@LOWER[%ARC] then
  74.   color bright blink red on black
  75.   echo Cannot convert file to itself!
  76.   color white on black
  77.   goto syntax
  78. endiff
  79.  
  80. :: Convert:
  81. echo Converting from %@EXT[%RUN] to %ARC...
  82. if isdir $$$$TEMP.$$1 .or. exist $$$$TEMP.$$1 goto error
  83. md $$$$TEMP.$$1
  84. cd $$$$TEMP.$$1
  85.